package com.rzico.core.rider;

import jdk.nashorn.internal.objects.annotations.Constructor;
import lombok.Data;

import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;

@Data
public class RiderApiResponse {

    /**
     * 下单
     * @param orderAddRequest
     * @return
     * {
     *     "code": 0,
     *     "msg": "成功",
     *     "fee": "实际运费",
     * }
     */

    private static final int STATUS_CODE = -2;

    private final static String STATUS_MSG = "请求超时异常";

    private String status;
    private int code;
    private String msg;
    private String orderSn;
    private BigDecimal fee;
    private Integer statusCode;
    private Integer cancel_from;	//	订单取消原因来源(1:配送员取消；2:商家主动取消；3:系统或客服取消；0:默认值)
    private String dmName;	// 配送员姓名，接单以后会传
    private String dmMobile;	// 配送员手机号，接单以后会传
    private Double lat;// 配送员位置
    private Double lng;// 配送员位置

    private Map<String,Object> result;

//            *  待接单: statusCode = 1
//            *  待取货: statusCode = 2
//            *  配送中: statusCode = 3
//            *  已完成: statusCode = 4
//            *  已取消: statusCode = 5
//            *  已过期: statusCode = 7

    public RiderApiResponse(){

    }

    public RiderApiResponse(int code,String msg,String orderSn) {
        this.code = code;
        this.msg = msg;
    }

    public static RiderApiResponse except() {
        RiderApiResponse apiResponse = new RiderApiResponse();
        apiResponse.setCode(STATUS_CODE);
        apiResponse.setMsg(STATUS_MSG);
        return apiResponse;
    }

    public static RiderApiResponse error(int code, String msg,String orderSn) {
        RiderApiResponse r = new RiderApiResponse(code,msg,orderSn);
        return r;
    }

}
